<template>
  <div class="actions">
    <div v-if="props.isEdit[props.akey]">
      <n-button style="width: 100px" class="mr-10" @click="emit('cancel')">
        取消
      </n-button>
      <n-button style="width: 100px" type="primary" @click="emit('confirm')">
        保存
      </n-button>
    </div>

    <div v-else>
      <n-button style="width: 100px" type="primary" :disabled="props.disabled" @click="emit('edit')">
        编辑
      </n-button>
    </div>

    <div class="ml-10">
      <slot name="right"></slot>
    </div>
  </div>
</template>

<script setup>
const props = defineProps(['akey', 'isEdit', 'disabled'])
const emit = defineEmits(['cancel', 'confirm', 'edit'])
</script>

<style lang="scss" scoped></style>
